package contratosonline.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author admin
 */
@Entity
@Table(name = "setor", schema = "contratos")
@NamedQueries({@NamedQuery(name = "Setor.findAll", query = "SELECT s FROM Setor s"), @NamedQuery(name = "Setor.findByIdSetor", query = "SELECT s FROM Setor s WHERE s.idSetor = :idSetor"), @NamedQuery(name = "Setor.findByNomeSetor", query = "SELECT s FROM Setor s WHERE s.nomeSetor = :nomeSetor"), @NamedQuery(name = "Setor.findByTelefone", query = "SELECT s FROM Setor s WHERE s.telefone = :telefone")})
public class Setor implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "idSetor")
    private Integer idSetor;
    @Basic(optional = false)
    @Column(name = "nomeSetor")
    private String nomeSetor;
    @Column(name = "telefone")
    private String telefone;
    @JoinColumn(name = "campus", referencedColumnName = "idCampus")
    @ManyToOne(fetch = FetchType.EAGER)
    private Campus campus;
    @OneToMany(mappedBy = "setor", fetch = FetchType.EAGER)
    private Collection<FiscalContrato> fiscalcontratoCollection;

    public Setor() {
    }

    public Setor(Integer idSetor) {
        this.idSetor = idSetor;
    }

    public Setor(Integer idSetor, String nomeSetor) {
        this.idSetor = idSetor;
        this.nomeSetor = nomeSetor;
    }

    public Integer getIdSetor() {
        return idSetor;
    }

    public void setIdSetor(Integer idSetor) {
        this.idSetor = idSetor;
    }

    public String getNomeSetor() {
        return nomeSetor;
    }

    public void setNomeSetor(String nomeSetor) {
        this.nomeSetor = nomeSetor;
    }

    public String getTelefone() {
        return telefone;
    }

    public void setTelefone(String telefone) {
        this.telefone = telefone;
    }

    public Campus getCampus() {
        return campus;
    }

    public void setCampus(Campus campus) {
        this.campus = campus;
    }

    public Collection<FiscalContrato> getFiscalcontratoCollection() {
        return fiscalcontratoCollection;
    }

    public void setFiscalcontratoCollection(Collection<FiscalContrato> fiscalcontratoCollection) {
        this.fiscalcontratoCollection = fiscalcontratoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSetor != null ? idSetor.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Setor)) {
            return false;
        }
        Setor other = (Setor) object;
        if ((this.idSetor == null && other.idSetor != null) || (this.idSetor != null && !this.idSetor.equals(other.idSetor))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "contratosonline.entity.Setor[idSetor=" + idSetor + "]";
    }

}

